.TH "Zebulon::MCU::Interface" 3 "13 Oct 2009" "Version 2" "zebulon" \" -*- nroff -*-
.ad l
.nh
.SH NAME
Zebulon::MCU::Interface \- 
.PP
\fBInterface\fP class for the Underwater Vehicle to the MCU motor \fBcontrol\fP.  

.SH SYNOPSIS
.br
.PP
.PP
\fC#include <interface.h>\fP
.SS "Classes"

.in +1c
.ti -1c
.RI "class \fBCallback\fP"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBInterface\fP ()"
.br
.RI "\fIConstructor. \fP"
.ti -1c
.RI "\fB~Interface\fP ()"
.br
.RI "\fIDestructor. \fP"
.ti -1c
.RI "bool \fBInitialize\fP (const std::string &port, const unsigned short baud, const bool tryOtherBauds=true)"
.br
.RI "\fIEstablishes a connection to the device by searching different BAUDS on a port. \fP"
.ti -1c
.RI "void \fBShutdown\fP ()"
.br
.RI "\fIShutsdown the interface. \fP"
.ti -1c
.RI "bool \fBSend\fP (const \fBMessage\fP *message)"
.br
.RI "\fISends the message over the serial port to the device. \fP"
.ti -1c
.RI "bool \fBRegisterCallback\fP (const \fBMessage::Code\fP type, \fBCallback\fP *cb)"
.br
.RI "\fIUse this method to register a callback to be run whenever a specific type of message is received. \fP"
.ti -1c
.RI "void \fBRemoveCallback\fP (const \fBMessage::Code\fP type, \fBCallback\fP *cb)"
.br
.RI "\fIUse this method to unregister a callback. \fP"
.ti -1c
.RI "void \fBClearCallback\fP ()"
.br
.RI "\fIClears all registered callbacks. \fP"
.in -1c
.SS "Static Public Member Functions"

.in +1c
.ti -1c
.RI "static \fBMessage\fP * \fBCreateMessage\fP (const \fBMessage::Code\fP type)"
.br
.RI "\fIThis method is used to create an instance of any type of MCU message. \fP"
.in -1c
.SS "Static Protected Member Functions"

.in +1c
.ti -1c
.RI "static void \fBMCUThread\fP (void *arg)"
.br
.RI "\fIThread used to receive data from sensor. \fP"
.in -1c
.SS "Protected Attributes"

.in +1c
.ti -1c
.RI "CxUtils::Thread \fBmMCUThread\fP"
.br
.RI "\fIManages/creates thread. \fP"
.ti -1c
.RI "CxUtils::Mutex \fBmMCUMutex\fP"
.br
.RI "\fIMutex for thread protection of data members. \fP"
.ti -1c
.RI "CxUtils::Serial \fBmSerial\fP"
.br
.RI "\fIConnection to serial port. \fP"
.ti -1c
.RI "\fBMessage::List\fP \fBmMessageQueue\fP"
.br
.RI "\fIQueue of received MCU messages. \fP"
.in -1c
.SH "Detailed Description"
.PP 
\fBInterface\fP class for the Underwater Vehicle to the MCU motor \fBcontrol\fP. 
.SH "Member Function Documentation"
.PP 
.SS "\fBMessage\fP * Interface::CreateMessage (const \fBMessage::Code\fP type)\fC [static]\fP"
.PP
This method is used to create an instance of any type of MCU message. \fBParameters:\fP
.RS 4
\fItype\fP The type of message to create.
.RE
.PP
\fBReturns:\fP
.RS 4
Pointer to created message (you must delete it), NULL if type is unknown. 
.RE
.PP

.SS "bool Interface::Initialize (const std::string & port, const unsigned short baud, const bool tryOtherBauds = \fCtrue\fP)"
.PP
Establishes a connection to the device by searching different BAUDS on a port. \fBParameters:\fP
.RS 4
\fIport\fP The port name to connect on. 
.br
\fIbaud\fP The initial/first BAUD to try.
.RE
.PP
\fBReturns:\fP
.RS 4
True if connection established, otherwise false. 
.RE
.PP

.SS "void Interface::MCUThread (void * arg)\fC [static, protected]\fP"
.PP
Thread used to receive data from sensor. Runs a thread which continuously receives and parsed data from serial port. 
.SS "bool Interface::RegisterCallback (const \fBMessage::Code\fP type, \fBCallback\fP * cb)"
.PP
Use this method to register a callback to be run whenever a specific type of message is received. \fBParameters:\fP
.RS 4
\fItype\fP The type of message to subscribe to. 
.br
\fIcb\fP The callback to be run when the message is received.
.RE
.PP
\fBReturns:\fP
.RS 4
True on success, false on failure. 
.RE
.PP

.SS "void Interface::RemoveCallback (const \fBMessage::Code\fP type, \fBCallback\fP * cb)"
.PP
Use this method to unregister a callback. \fBParameters:\fP
.RS 4
\fItype\fP The type of message to subscribe to. 
.br
\fIcb\fP The callback to be run when the message is received. 
.RE
.PP

.SS "bool Interface::Send (const \fBMessage\fP * message)"
.PP
Sends the message over the serial port to the device. \fBParameters:\fP
.RS 4
\fImessage\fP Pointer to message structure to transmit.
.RE
.PP
\fBReturns:\fP
.RS 4
True on success, false on failure. 
.RE
.PP


.SH "Author"
.PP 
Generated automatically by Doxygen for zebulon from the source code.
